<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});


//加载登录页面
Route::get('login','LoginController@index');
//登录+注册处理
Route::post('login/loginOperation','LoginController@loginOperation')->name('login.loginOperation');


//需要中间件验证的路由
Route::middleware(['im_auth'])->group(function () {
    //退出登录
    Route::post('login/loginOut','LoginController@loginOut')->name('login.loginOut');

    //加载im用户好友列表
    Route::get('im/indexList', 'ImController@indexList')->name('im.indexList');
    //添加好友
    Route::post('im/addFriends', 'ImController@addFriends')->name('im.addFriends');
    //删除好友
    Route::post('im/deleteFriends/{friend_lists_id}', 'ImController@deleteFriends')->name('im.deleteFriends');
    //加载im用户聊天页面
    Route::get('im/chat/{friend_id}', 'ImController@chat')->name('im.chat');

    //绑定用户
    Route::post('im/binding', 'ImController@binding')->name('im.binding');
    //发送消息
    Route::post('im/sendMessage', 'ImController@sendMessage')->name('im.sendMessage');
});